/*
 * device_model.h
 *
 *  Created on: 12.06.2013
 *      Author: SpirTanol
 */

#ifndef DEVICE_MODEL_H_
#define DEVICE_MODEL_H_

// QT
#include <QAbstractItemModel>
#include <QVector>

class DeviceInfo;

class DeviceModel : public QAbstractItemModel
{
	QVector<DeviceInfo*> *oDeviceList;

public:
	DeviceModel(QVector<DeviceInfo*> *list, QObject *parent = 0);
	~DeviceModel();

	int columnCount(const QModelIndex &parent = QModelIndex()) const; // [virtual]
	int rowCount(const QModelIndex &parent = QModelIndex()) const; // [virtual]

	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; // [virtual]
	QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; // [virtual]

	QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; // [virtual]
	QModelIndex parent(const QModelIndex &index) const; // [virtual]
	bool hasChildren(const QModelIndex &parent = QModelIndex()) const; // [virtual]

	Qt::ItemFlags flags(const QModelIndex &index) const; // [virtual]

	DeviceInfo *deviceOf(const QModelIndex &index) const;

	void addItem();
	inline void clear() { reset(); }
};

#endif /* DEVICE_MODEL_H_ */
